﻿using System;
using System.IO;
using System.Windows.Forms;
using EzDeploy.Core;

namespace EzDeploy
{
    public partial class StrongNameKeyWarningForm : Form
    {
        readonly Project _project;
        private string _strongNameKeyFile;

        public string StrongNameKeyFile
        {
            get
            {
                return _strongNameKeyFile;
            }
        }

        public StrongNameKeyWarningForm(Project project)
        {
            InitializeComponent();
            _project = project;
        }

        /// <summary>
        /// Browses the specified sender.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void Browse(object sender, EventArgs e)
        {
            openStrongNameKeyFile.InitialDirectory = Path.GetDirectoryName(_project.AssemblyFile);
          
            if (openStrongNameKeyFile.ShowDialog() == DialogResult.OK)
            {
                _strongNameKeyFile = openStrongNameKeyFile.FileName;
                this.DialogResult = DialogResult.OK;
            }
        }

        private void Ignore(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Ignore;
        }

        private void Cancel(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }
    }
}
